package com.bocomm.tracevisualization.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.bocomm.tracevisualization.api.entity.TraceTargetDataDetail;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * traceroute的每一行返回值 Mapper 接口
 * </p>
 *
 * @author cxp
 * @since 2024-03-20
 */
public interface TraceTargetDataDetailMapper extends BaseMapper<TraceTargetDataDetail> {

    @Select("select * from trace_target_data_detail td , (select max(trace_time) as trace_time  from trace_target_data_detail where job_id = #{jobId} and source_ip =#{sourceIp} ) t where td.job_id = #{jobId} and source_ip =#{sourceIp} and td.trace_time = t.trace_time")
    List<TraceTargetDataDetail> sequenceDiagram(@Param("jobId") String jobId,@Param("sourceIp")String sourceIp);

}
